package com.ruoyi.web.controller.invoice;

import cn.hutool.json.JSONObject;
import com.ruoyi.dto.JqbhDto;
import com.ruoyi.third.base.InvoiceApiResult;
import com.ruoyi.third.entity.result.Skp;
import com.ruoyi.third.service.ThirdApiService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


@Api(tags = "税控盘")
@RestController
@AllArgsConstructor
@RequestMapping("invoice/skp")
public class SkpController {

    private final ThirdApiService thirdApiService;


    @ApiOperation(value = "税控盘信息", httpMethod = "POST")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "jqbh", value = "机器编号", dataTypeClass = String.class)
    })
    @PostMapping("skpInfo")
    public InvoiceApiResult<Skp> skpInfo(@RequestBody @Validated JqbhDto jqbhDto) {
        return thirdApiService.SkpInfo(jqbhDto.getJqbh());
    }

    @ApiOperation(value = "税种税目", httpMethod = "POST")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "jqbh", value = "机器编号", dataTypeClass = String.class)
    })
    @PostMapping("szsm")
    public InvoiceApiResult szsm(@RequestBody @Validated JqbhDto jqbhDto) {
        return thirdApiService.szsm(jqbhDto.getJqbh());
    }

    @ApiOperation(value = "监控管理信息查询", httpMethod = "POST")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "jqbh", value = "机器编号", dataTypeClass = String.class)
    })
    @PostMapping("monitorStrationData")
    public InvoiceApiResult monitorStrationData(@RequestBody @Validated JqbhDto jqbhDto) {
        return thirdApiService.monitorStrationData(jqbhDto.getJqbh());
    }

    @ApiOperation(value = "获取服务器信息", httpMethod = "POST")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "jqbh", value = "机器编号", dataTypeClass = String.class)
    })
    @PostMapping("obtainServerEssInfor")
    public InvoiceApiResult<JSONObject> obtainServerEssInfor(@RequestBody @Validated JqbhDto jqbhDto) {
        return thirdApiService.obtainServerEssInfor(jqbhDto.getJqbh());
    }
}
